package main.controller;

import com.google.gson.Gson;
import main.dao.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("add")
public class Addcontroller extends  Basecontroller
{
    @Autowired
    Gson gson;
        @RequestMapping("/text")
    public ModelAndView mm ()
        {
            ModelAndView mm=new ModelAndView();
            User user=new User();
            user.setUserId(20);
            user.setHome("西安");
            mm.addObject("user",gson.toJson(user));
            mm.setViewName("hello");
            response.setHeader("Access-Control-Allow-Origin", "*");
            return  mm;
        }
}
